/**
* Class to manage a generic field properties
*
* Project: idbCrownInServer
* Author:  TM
* Date:    07/04/2013
*
* History
* ------------------
* 07/04/2013 - TM - Initial version.
*/
 
 
package DataModel;

import java.sql.*;
import java.util.TimeZone;
import java.text.*;

import Util.*;

public class libField
{
   /** Class variables */
   protected String  fieldName;
   protected boolean isKey;
   protected Object  value;

   /** Constructor */
   public libField (String name)
   {
	    this(name, false);
   }

   /** Constructor */
   public libField (String name, boolean key)
   {
	    fieldName = name;
     isKey     = key;
   }
   
   /** public assign value into prepareStatement */
   public void assignValue(int index, PreparedStatement pst) throws Exception
   {
     pst.setString(index, getValue() != null ? getValue().toString() : null);
   }
   
   //GETTERS
   public String  getName ()   {return fieldName;}
   public boolean isKey   ()   {return isKey;}
   public Object  getValue()   {return value;}
   
   //SETTERS
   public void setValue (Object currValue) {value = currValue;}
 
   /** Debug utility method */
   protected void debug(String msg)
   {
     libFileDebug.getInstance().write("libField." + msg);
   }
   

}
